﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using GrewalCRM.Entities;

namespace GrewalCRM.DAL
{
  public class ReffStatus_DAL:BaseDALGrewalCRM,IBaseDALGrewalCRM
  {
    #region Protected Methods
    public override int AddNew(BaseEntitiesGrewalCRM Entity)
    {
      throw new NotImplementedException();
    }

    public override int Update(BaseEntitiesGrewalCRM Entity)
    {
      throw new NotImplementedException();
    }

    public override int Delete(BaseEntitiesGrewalCRM Entity)
    {
      throw new NotImplementedException();
    } 
    #endregion

    #region Public Method
    public int Save(BaseEntitiesGrewalCRM Entity)
    {
      throw new NotImplementedException();
    }

    public override List<BaseEntitiesGrewalCRM> GetAll()
    {

      Cmd.CommandText = "usp_GetAllReff_Status";     
      Cmd.Connection.Open();
      SqlDataReader rdr = Cmd.ExecuteReader();
      List<BaseEntitiesGrewalCRM> allStatus = new List<BaseEntitiesGrewalCRM>();

      if (rdr != null && rdr.HasRows)
      {
        while (rdr.Read())
        {
          ReffStatus callStatus = new ReffStatus(rdr[0] != null && rdr[0].GetType() != typeof(DBNull) ? rdr.GetInt32(0) : 0,
                                                  rdr[1] != null && rdr[1].GetType() != typeof(DBNull) ? rdr.GetString(1) : string.Empty,
                                                  rdr[2] != null && rdr[2].GetType() != typeof(DBNull) ? rdr.GetString(2) : string.Empty,
                                                  null,null
                                                 );


          allStatus.Add(callStatus);
        }
      }
      Cmd.Connection.Close();

      return allStatus;      
    }

    public override BaseEntitiesGrewalCRM GetByID(int ID)
    {
      throw new NotImplementedException();
    }

    public override void FillEntity(BaseEntitiesGrewalCRM Entity)
    {
      throw new NotImplementedException();
    } 
    #endregion
  }
}
